package cn.itcast.nems.studentrecord.service.impl;

import cn.itcast.nems.studentrecord.dto.change.StudentRecordChangeCheckOriginDTO;
import cn.itcast.nems.studentrecord.dto.change.StudentRecordTransactionChangeCheckDTO;

import java.util.List;

/**
 * 检查学籍变更是否允许退学
 *
 * @author liyong
 * create: 2023-12-07 10:21:30
 **/
class StudentRecordChangeDropoutChecker extends StudentRecordChangeChecker {

    /**
     * 检查学籍是否可以变更
     *
     * @param studentRecordOrigin       要变更的源学籍
     * @param studentRecordTransactions 学员学籍流转记录
     */
    StudentRecordChangeDropoutChecker(StudentRecordChangeCheckOriginDTO studentRecordOrigin,
                                      List<StudentRecordTransactionChangeCheckDTO> studentRecordTransactions) {
        super(studentRecordOrigin, studentRecordTransactions);
    }

    @Override
    protected void checkOriginTarget(Integer targetClazzId) {
        final Integer originClazzId = super.studentRecordOrigin.getClazzId();
        if (targetClazzId != null && originClazzId != null && originClazzId.intValue() != targetClazzId.intValue()) {
            super.cannotChange("退学原学籍和目标学籍班级应该为同一班");
        }
    }
}
